package com.acme.bankapp.service.bank;

import java.util.List;

import com.acme.bankapp.domain.bank.*;

public class BankService {
	public static void addClient(Bank bank, Client client) {
		bank.addClient(client);
	}
	
	public static Bank createBank() {
		return new Bank();
	}

	public static Bank createBank(ClientRegistrationListener[] clientRegistrationListeners ) {
		return new Bank(clientRegistrationListeners);
	}

	public static List<Client> getClients(Bank bank) {
	    return bank.getClients();
	}
	
	public static void printClients(Bank bank) {
		for (Client client : getClients(bank)) {
			System.out.println(client.getClientSalutation() + " has a " + client.getAccount().getClass().getSimpleName() + ", and he/she can withdraw " + client.getAccount().getMaximumAmountToWithdraw() + " while balance is " + client.getAccount().getBalance());
		}
	}
	
	public static void printBalance(Bank bank) {
		for (Client client : getClients(bank)) {
			System.out.println(client.getClientSalutation() + "'s balance is " + client.getAccount().getBalance());
		}
	}
	
	public static void printMaximumAmountToWithdraw(Bank bank) {
		for (Client client : getClients(bank)) {
			System.out.println(client.getClientSalutation() + " can withdraw " + client.getAccount().getMaximumAmountToWithdraw());
		}
	}
}
